﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;


namespace ATM
{
    public partial class inter_face : Form
    {
        public string x;
        public inter_face(string acc)
        {
            InitializeComponent();
            x = acc;
        }

        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            withdraw frm = new withdraw(x);
            frm.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.Hide();
            deposit frm = new deposit(x);
            frm.Show();
        }

        private void button7_Click(object sender, EventArgs e)
        {
            string myconnection = "datasource=localhost;port=3306;username=root;password=nitro";
            MySqlConnection myconn = new MySqlConnection(myconnection);

          
            MySqlCommand SelectCommand = new MySqlCommand("SELECT * FROM atm.atm_customers where Account_Number='" + this.x + "';", myconn);

            try
            {

                MySqlDataAdapter sda = new MySqlDataAdapter();
                sda.SelectCommand = SelectCommand;
                DataTable dbdataset = new DataTable();
                sda.Fill(dbdataset);
                BindingSource bsource = new BindingSource();
                bsource.DataSource = dbdataset;
                dataGridView1.DataSource = bsource;
                sda.Update(dbdataset);
                



                
                



               
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void button8_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }
    }
}
